import fetch from '@/utils/fetch'

export function login(data) {
  return fetch({
    url: '/sys/login',
    method: 'POST',
    data
  })
}

export function signup(data) {
  return fetch({
    url: '/user/signup',
    method: 'POST',
    data
  })
}

export function getUserInfo() {
  return fetch({
    url: '/user/info',
    method: 'GET'
  })
}

export function logUserOut(logoutToken) {
  return fetch({
    url: '/sys/logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      'X-Access-Token':  logoutToken
    }
  })
}

export function getCheckCode(cuTime) {
  return fetch({
    url: `/sys/randomImage/${cuTime}`, 
    method: 'GET'
  })
}
